import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      meta: {
        title: '主页',
        isNoLogin: false,
      },
    },
    {
      path: '/business',
      name: 'business',
      component: ()=>import("../views/Business.vue"),
      meta: {
        title: '商家',
        isNoLogin: true,
        index:2
      },
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/CartFood.vue'),
      meta: {
        title: '外卖袋',
        isNoLogin: true,
        index:3
      },
    },
    {
      path: '/usercontent',
      name: 'usercontent',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/UserContent.vue'),
      meta: {
        title: '用户资料',
        isNoLogin: true,
      },
    },
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/Login.vue'),
      meta: {
        title: '登录',
        isDisableBreadcrumbLink: true,
        isShowBreadcrumb: false,
        addToSidebar: false,
        sidebarIcon: '',
        sidebarIconAlt: '',
        isNoLogin: true,
        index:1
      },
    }
  ]
})

export default router
